-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add labels meta #959
Conversation
@shahzad31 I'm worried this will confusing since the lightweight representation is not a valid heartbeat monitor and effectively undocumented, wdyt? |
@emilioalvap i will create a docs issue in a follow up to document this. |
src/push/monitor.ts
Outdated
@@ -268,6 +268,7 @@ export function buildMonitorFromYaml( | |||
enabled: config.enabled ?? options.enabled, | |||
locations: options.locations, | |||
tags: options.tags, | |||
labels: parseLabels(config, options.labels), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this new field to some of the unit tests validating lightweight monitors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have added here 200e52f
(#959)
src/common_types.ts
Outdated
@@ -255,6 +255,7 @@ export type PushOptions = Partial<ProjectSettings> & | |||
kibanaVersion?: string; | |||
yes?: boolean; | |||
tags?: Array<string>; | |||
labels?: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this to fields to map with the heartbeat top level fields name and under the hood in Kibana, you can map to labels. Having labels as top level is confusing - https://www.elastic.co/guide/en/beats/heartbeat/8.12/configuration-general-options.html#libbeat-configuration-fields
Also let's write JS doc annotation so it's visible on TS config.
__tests__/push/monitor.test.ts
Outdated
@@ -472,6 +472,50 @@ heartbeat.monitors: | |||
hosts: ['elastic.co:443'], | |||
}); | |||
}); | |||
|
|||
it('supports labels in config', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add test for browser monitor as well.
If using < 8.16.0, are these just ignored (i.e. it won't fail to |
@paulb-elastic validation will fail the push. User will need to remove labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, Can you add a test for Browser monitor and supplying both global and monitor fields. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Allows the ability to add meta via fields.* fields, data will be appended under labels.* in heartbeat documents !!
fixes #729 !!
This will only work with kibana 8.16.0 with PR elastic/kibana#193250 !!
lightweight